<% @assignments = Assignment.find_by_team(session[:set_team]) %>

<%=
calendar(:year => @year, :month => @month) do |d|
  cell_text = "#{d.mday}<br />" 
  cell_attrs = {:class => 'day'}
  @assignments.group_by(&:date_sql).each do |datesy, itn ,g, assign|
    if datesy == d.to_s
	  itn.group_by(&:instance_type_name).each do |itn, g, assign|
	
      cell_text << "<strong>" << itn << "</strong>" << "<br />"
		g.group_by(&:group_name).each do |g, assign|
			cell_text << "<strong>" << g << "</strong>" << "<br />"
				assign.each do |a|
					cell_text << link_to("#{a.full_name_b}",
					 			 {:controller => 'assignments',
								 :action => 'show',
								 :id => a.id}, {:title => "Team: #{a.team_name}  Job: #{a.job_title}"} ) << link_to_remote("X", :url => {:controller => 'assignments',
						 													:action => 'delete_assignment',
																			:id => a.id }) << "<br />"
				end
			
		end
		
		

      cell_attrs[:class] = 'specialDay'
	end
    end
  end
  [cell_text, cell_attrs]
end
%>
